<template>
  <div class="ranking">
    <!--背景-->
    <div class="box_div">
      <img src="../../assets/images/bg_red.png" alt="">
    </div>
    <!--右上角-->
    <div class="box_right"  @click="openPop()">
      <img src="../../assets/images/icon.png" alt="">
    </div>
    <!--头像-->
    <div class="box_img">
      <img src="../../assets/images/p-1.png" alt="">
    </div>
    <!--排名-->
    <div class="box_content">
      <ul>
        <li>
          <div class="top">
            <countup :start-val="1" :end-val="9999" :duration="2"></countup>
            <span>名</span></div>
          <div class="buttom">本地排名</div>
        </li>
        <li>
          <div class="top_center">我爱喝酒<span>侍酒师</span></div>
          <div class="buttom_center">我的积分<span>2566</span></div>
        </li>
        <li>
          <div class="top_right">
            <countup :start-val="1" :end-val="9999" :duration="2"></countup>
            <span>名</span></div>
          <div class="buttom">全国排名</div>
        </li>
      </ul>
    </div>
    <div class="box_li">
      <ul>
        <li class="pb_li">
          <div class="left">1</div>
          <div class="center">
            <span><img src="../../assets/images/p-1.png" alt=""></span>
            <span>我是侍酒师</span>
          </div>
          <div class="right">
            <p>59666</p>
            <p>他的积分</p>
          </div>
        </li>
        <li class="pb_li">
          <div class="left">2</div>
          <div class="center">
            <span><img src="../../assets/images/p-1.png" alt=""></span>
            <span>我是侍酒师</span>
          </div>
          <div class="right">
            <p>69999</p>
            <p>他的积分</p>
          </div>
        </li>
        <li class="pb_li">
          <div class="left">3</div>
          <div class="center">
            <span><img src="../../assets/images/p-1.png" alt=""></span>
            <span>我是侍酒师</span>
          </div>
          <div class="right">
            <p>66666</p>
            <p>他的积分</p>
          </div>
        </li>
      </ul>
    </div>
    <!--筛选弹窗-->
    <div class="filter-pop" :class="{show:isShow}">
      <div style="height:100%;" @click="closePop()"></div>
      <div class="filter-bg">
        <p>筛选</p>
        <!--侍酒师，历史筛选内容-->
        <div class="select-box">
          <div class="row-title">类别</div>
          <div class="select-info">
            <template v-for="(item,index) in classifyData">
              <span class="si-item" :class="{on:selecte==index}"
                    @click="selecte=index,changedClassify(index)">{{item}}</span>
            </template>
          </div>
        </div>

        <button type="button" class="confirm-btn" @click="sommmeliresConfirm()">确定</button>
      </div>
    </div>

  </div>
</template>

<script>
  import Banner from '../public/banner.vue'
  import {Countup} from "vux"

  export default {
    name: "ranking",
    components: {
      "banner": Banner,
      "countup": Countup,
    },
    data() {
      return {
        isShow: false,
        classifyData:['全国排名','本地排名'],//弹窗类别
        selecte:0,
      }
    },
    methods:{
      // 打开筛选弹窗
      openPop() {
        this.isShow = true;
      },
      //筛选 确定按钮
      sommmeliresConfirm() {
        this.closePop();
      },
      // 关闭筛选弹窗
      closePop() {
        this.isShow = false;
      },
      // 选择年龄
      changedClassify(idx) {
        console.log(idx);
      },
    },
    created: function () {
      document.title = "排名";
    }
  }
</script>

<style lang="less" scoped>
  .ranking {
    width: 100%;
    min-height: 120px;
    /*头部背景*/
    .box_div {
      width: 100%;
      min-height: 80px;
    }
    .box_div img {
      width: 100%;
      height: 145px;
    }
    .box_right {
      width: 48px;
      height: 40px;
      position: absolute;
      top: 15px;
      right: 0px;
    }
    .box_right img {
      width: 28px;
      height: 20px;
    }
    .box_img {
      width: 120px;
      height: 120px;
      margin: 0 auto;
      position: absolute;
      top: 20px;
      left: 0;
      right: 0;
      z-index: 1;
      overflow: hidden;
      border-radius: 60px;
    }
    .box_img img {
      width: 100%;
      height: 100%;
    }
    .box_content {
      width: 93%;
      margin: 0 auto;
      height: 90px;
      border: 1px solid #EFEFEF;
      position: relative;
      top: -32px;
      border-radius: 15px;
      background: #FFF;
      box-shadow: 0px 1px 0px #cac5c5;
    }
    /*排名*/
    .box_content ul li {
      width: 28%;
      height: 90px;
      float: left;
      text-align: center;
    }
    .box_content ul li:nth-child(2) {
      width: 44%;
      height: 90px;
    }
    .top {
      padding-top: 30px;
      color: #F57B7A;
    }
    .top span:last-child {
      font-size: 0.8rem;
    }
    .top span:first-child {
      font-size: 1.3rem;
    }
    .top_right {
      padding-top: 30px;
      color: #C29CED;
      font-size: 1.5rem;
    }
    .top_right span:last-child {
      font-size: 0.8rem;
    }
    .top_right span:first-child {
      font-size: 1.3rem;
    }
    .top_center {
      padding-top: 30px;
      font-size: 1rem;
    }
    .top_center > span {
      font-size: 0.6rem;
      display: inline-block;
      padding: 0px 5px;
      background: #F94242;
      border-radius: 8px;
      color: #FFF;
    }
    .buttom_center {
      font-size: 0.8rem;
      margin-top: 6px;
    }
    .buttom_center > span {
      padding-left: 10px;
      color: #F94242
    }
    .buttom {
      font-size: 0.8rem;
    }
    .box_li {
      width: 92%;
      min-height: 80px;
      margin: 0 auto;
      .pb_li {
        width: 100%;
        min-height: 40px;
        border-bottom: 1px solid #f5f5f5;
        overflow: hidden;
        padding: 10px 0;
      }
      .left {
        width: 25%;
        float: left;
        min-height: 40px;
        line-height: 40px;
        text-align: center;
        font-size: 1.5rem;
      }
      .center {
        width: 45%;
        float: left;
        min-height: 40px;
        line-height: 40px;
        padding-left: 10px;
        font-size: 0.9rem;
        img {
          width: 36px;
          height: 36px;
          border-radius: 18px;
          vertical-align: middle;
        }
      }
      .right {
        width: 30%;
        min-height: 40px;
        float: left;
        text-align: center;
        p:first-child {
          font-size: 1.3rem;
        }
        p:last-child {
          font-size: 0.6rem;
        }
      }
    }

  }

  /*筛选弹窗*/
  .filter-pop {
    position: fixed;
    top: 0;
    left: 100%;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .6);
    transition: 0.5s all;
    z-index: 20;
    .filter-bg {
      position: absolute;
      top: 0;
      right: 0;
      width: 80%;
      height: 100%;
      background: #fff;
      p {
        width: 100%;
        height: 40px;
        line-height: 40px;
        padding-left: 10px;
        background: #F3F3F3;
        font-size: 0.95rem;
        color: #777;
      }
      .select-box {
        width: 100%;
        padding-left: 10px;
        margin: 10px auto 0;
        .row-title {
          height: 30px;
          line-height: 30px;
          font-size: 0.95rem;
          color: #777;
        }
        .select-info {
          display: flex;
          flex-wrap: wrap;
          .si-item {
            font-size: 0.9rem;
            color: #777;
            padding: 2px 10px;
            border: 1px solid #aaa;
            border-radius: 20px;
            margin-right: 5%;
            margin-bottom: 10px;
          }
          .on {
            border: 1px solid #D44242;
            background: #D44242;
            color: #fff;
          }
        }
      }
      /*button*/
      .confirm-btn {
        width: 60%;
        height: 40px;
        border: none;
        border-radius: 4px;
        background: #D44242;
        font-size: 1rem;
        color: #fff;
        margin-left: 20%;
        margin-top: 60%;
      }
    }
  }
  .show {
    left: 0;
  }
</style>
